package com.wxmit.module.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.wxmit.module.system.domain.SysRole;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author huangxiong
 * @date 2023/11/20 15:29
 */
@Service("DataDynamicTransactionalService")
public class DataDynamicTransactionalService {

    @DS("master")
    public void do01(){
        System.out.println("master:::update");
        Db.lambdaUpdate(SysRole.class).eq(SysRole::getId,6L).set(SysRole::getRoleName,"测试管理员").update();
    }


    @DS("slave")
    public void do02(){
        System.out.println("slave:::update");
        Db.lambdaUpdate(SysRole.class).eq(SysRole::getId,6L).set(SysRole::getRoleName,"测试管理员80").update();
    }
}
